package com.example.rbac.uitls;

import org.apache.ibatis.javassist.ClassPool;
import org.apache.ibatis.javassist.CtClass;
import org.apache.ibatis.javassist.CtMethod;

public class Test {


    public static void main(String[] args) {
        try {
            ClassPool classPool = new ClassPool();
            CtClass ctClass = classPool.get("xcp.lib.lock.Main");
            CtMethod[] methods = ctClass.getMethods();
            for (CtMethod method : methods) {
                if ("sayHello".equals(methods)){
                    method.insertBefore("long begin = System.currentTimeMillis();");
                    method.insertAfter("System.out.println(new Date().getTime() - begin);");
                }
            }
        } catch (Exception e){
            System.out.println(e);
        }
    }
}
